package com.mqstudy.common.util;

import com.mqstudy.common.model.Message;

import java.time.LocalDateTime;
import java.util.UUID;

/**
 * 消息工具类
 */
public class MessageUtil {
    
    /**
     * 创建测试消息
     */
    public static Message createTestMessage(String topic, String content) {
        return Message.builder()
                .messageId(UUID.randomUUID().toString())
                .topic(topic)
                .content(content)
                .messageType("TEST")
                .sendTime(LocalDateTime.now())
                .tags("test")
                .key("test-key")
                .build();
    }
    
    /**
     * 创建延迟消息
     */
    public static Message createDelayMessage(String topic, String content, int delayLevel) {
        return Message.builder()
                .messageId(UUID.randomUUID().toString())
                .topic(topic)
                .content(content)
                .messageType("DELAY")
                .sendTime(LocalDateTime.now())
                .tags("delay")
                .key("delay-key")
                .delayLevel(delayLevel)
                .build();
    }
    
    /**
     * 创建订单消息
     */
    public static Message createOrderMessage(String orderId, String orderInfo) {
        return Message.builder()
                .messageId(UUID.randomUUID().toString())
                .topic("order-topic")
                .content(orderInfo)
                .messageType("ORDER")
                .sendTime(LocalDateTime.now())
                .tags("order")
                .key(orderId)
                .build();
    }
} 